﻿@using Topro.Entity.Response.DeviceData
@using Topro.Entity.Enum

@model Topro.Entity.PagedList<DeviceDataQueryResponse>

<div class="data-body data-scroll">
    <div class="data-view">
        <div class="data-div-view table-responsive">
            <table class="table table-hover table-striped table-bordered">
                <thead>
                    <tr>
                        <th width="150" class="t_l">设备区域</th>
                        <th class="t_l">异常内容</th>
                        <th width="75">设备状态</th>
                        <th width="100" class="t_l">编号</th>
                        <th width="150" class="t_l">开始时间</th>
                        <th width="150" class="t_c">结束时间</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null && Model.TData != null && Model.TData.Any())
                    {
                        foreach (var item in (List<Topro.Entity.Response.DeviceData.DeviceDataQueryResponse>)Model.TData)
                        {
                            <tr>
                                <td width="150" class="t_l">
                                    @(item.DeviceLine == 20 ? "组合区" : "PP区")
                                </td>
                                <td class="t_l">
                                    @{
                                        var stringMessage = item.Message;
                                        if(item.Index == -1)
                                        {
                                            stringMessage = "";
                                        }
                                    }
                                    @(stringMessage)
                                </td>
                                <td width="75">
                                    @{
                                        var statusString = "";

                                        if(item.Status == 1)
                                        {
                                            statusString = "工作";
                                        }
                                        else if(item.Status == 2)
                                        {
                                            statusString = "空闲";
                                        }
                                        else if(item.Status == 3)
                                        {
                                            statusString = "异常";

                                            if(item.Index == -1)
                                            {
                                                statusString = "";
                                            }
                                        }
                                        else if(item.Status == 4)
                                        {
                                            statusString = "换料";
                                        }
                                        else if(item.Status == 5)
                                        {
                                            statusString = "班保养";
                                        }
                                        else if(item.Status == 6)
                                        {
                                            statusString = "周保养";
                                        }
                                        else if(item.Status == 7)
                                        {
                                            statusString = "堵满本";
                                        }
                                        else if(item.Status == 8)
                                        {
                                            statusString = "待空底板";
                                        }
                                        else if(item.Status == 9)
                                        {
                                            statusString = "换钢板";
                                        }
                                        else if(item.Status == 10)
                                        {
                                            statusString = "换铜箔";
                                        }
                                        else if(item.Status == 11)
                                        {
                                            statusString = "换PP";
                                        }
                                        else if(item.Status == 12)
                                        {
                                            statusString = "无板生产";
                                        }
                                        else if(item.Status == 13)
                                        {
                                            statusString = "禁止生产";
                                        }
                                        else if(item.Status == 14)
                                        {
                                            statusString = "计划停机";
                                        }
                                        else if(item.Status == 15)
                                        {
                                            statusString = "设备维修";
                                        }
                                    }
                                    @(statusString)
                                </td>
                                <td width="100" class="t_l">@(item.Id)</td>
                                <td width="150" class="t_l">@(item.StartTime)</td>
                                <td width="150" class="t_c">@(item.EndTime)</td>
                            </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="6" class="t_c">暂无记录</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- 必要的分页参数设置 -->
<input type="hidden" id="TotalCount" value="@(Model != null ? Model.TotalCount : 0)" />